home *** CD-ROM | disk | FTP | other *** search
- Path: maverick.tad.eds.com!news-admin@tad.eds.com
- From: Ed McGuffey <fgae23@ods04.and.ifg.gmeds.com>
- Newsgroups: comp.lang.c
- Subject: Re: simple code, argc, argv, strcmp()
- Date: 16 Feb 1996 13:08:49 GMT
- Organization: Indiana Resource Center
- Message-ID: <4g1vl1$rm2@maverick.tad.eds.com>
- References: <11f7cc$17261a.3b3@daprez>
- NNTP-Posting-Host: ods04.and.ifg.gmeds.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.12 (X11; I; HP-UX A.09.05 9000/715)
- X-URL: news:11f7cc$17261a.3b3@daprez
-
- If you really want to use the !, try:
-
- if (!((strcmp(argv[1], "-d") || (strcmp(argv[1], "-e")))
- Usage();
-
- since you want the ! to apply to the entire expression consisting of the
- two compares. The code is more readable, however, to avoid negative logic
- altogether and just say:
-
- if ((strcmp(argv[1], "-d") || (strcmp(argv[1], "-e"))
- function();
- else
- Usage();
-
-